package com.csp.mingyue.common.satoken.service;

import cn.dev33.satoken.stp.StpInterface;
import com.csp.mingyue.common.satoken.utils.LoginHelper;
import com.csp.mingyue.system.api.vo.LoginUser;

import java.util.ArrayList;
import java.util.List;

/**
 * Sa-Token 权限管理实现
 *
 * @author njy
 * @date 2023/8/8 14:54
 */
public class SaPermissionImpl implements StpInterface {

	@Override
	public List<String> getPermissionList(Object loginId, String loginType) {
		LoginUser loginUser = LoginHelper.getLoginUser();
		return new ArrayList<>(loginUser.getMenuPermission());
	}

	@Override
	public List<String> getRoleList(Object loginId, String loginType) {
		LoginUser loginUser = LoginHelper.getLoginUser();
		return new ArrayList<>(loginUser.getRolePermission());
	}

}
